import java.util.Random;

public class Hero implements Safe{
    String name;
    int life;
    int damagel;
    int defence;

    //double hitRate;
    //hitRate=0.8;
    public static int beAttacked(int life, int damagel, int defense) {
        double damageValue;
        Random d = new Random();
        int e = d.nextInt(5);
        double reduce;
        double defenses = (double) defense;
        double damagel1= (double) damagel;
        reduce = (defenses / (defenses + 100));
        damageValue = damagel1* (1 - reduce) + e;
        int damageValues = (int) damageValue;
        System.out.println("漂亮的一击,造成了" + damageValues + "点伤害");
        return damageValues;
    }

}
